package com.lin.controller.admin;

import com.lin.commons.Result;
import com.lin.entity.CarUserBill;
import com.lin.service.CarUserBillService;
import com.lin.vo.DataVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

/**
 * @Author Created by Lin Weihong
 * @Time on 2021/11/27 23:34
 */
@RestController
@CrossOrigin
@Slf4j
public class AdminCarUserBill {

    @Autowired
    private CarUserBillService carUserBillService;

    @GetMapping("/admin/carUserInfo")
    public DataVO<CarUserBill> getAllCarUserInfo(Integer page, Integer limit) {
        return carUserBillService.allCarUserBillsInformation(page, limit);
    }

    @GetMapping("/contract")
    public Result sendContract(@RequestParam("orderSerial") String orderSerial) throws IOException {
        log.info("****orderSerial: " + orderSerial);
        String contractResult = carUserBillService.sendContract(orderSerial);
        return Result.success(contractResult);
    }


}
